package com.cj.mapper;

import com.cj.pojo.AuditLog;
import org.apache.ibatis.annotations.*;
import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface AuditLogMapper {
        @Insert("INSERT INTO audit_log(user_id, action_type, target_id, ip, user_agent, details, created_at) " +
                "VALUES(#{userId}, #{actionType}, #{targetId}, #{ip}, #{userAgent}, #{details}, #{createdAt})")
        void add(AuditLog auditLog);

        @Delete("DELETE FROM audit_log WHERE id=#{id}")
        void delete(Long id);

        List<AuditLog> findByCriteria(Long userId, String actionType, 
                LocalDateTime startTime, LocalDateTime endTime,
                Integer pageNum, Integer pageSize);
}
